package com.qdlc.p2p.biz.processor.task;


import com.qdlc.p2p.biz.processor.event.CollectionTradeNotifyValueEvent;
import com.qdlc.p2p.common.core.queue.TaskProcessorException;
import com.qdlc.p2p.dal.dto.Tpp;
import com.qdlc.p2p.dal.dto.TppTradeLog;
import com.qdlc.p2p.dal.model.TppModel;

/**
 * 基础的抽象处理类，定义公用的失败状态处理逻辑
 * 针对于基本情况下的处理（非投标、非自动投标）
 * @author linya 016-01-13
 */
public abstract class AbstractCollectionTradeNotifyBaseTaskProcessor extends AbstractCollectionTradeNotifyTaskProcessor {

	/**
	 * 处理非投标、非自动投标 失败状态业务处理
	 * @param tppTradeLog
	 * @param tpp
	 * @param event
	 * @throws TaskProcessorException
	 */
	protected void doFail(TppTradeLog tppTradeLog, Tpp tpp, CollectionTradeNotifyValueEvent event) throws TaskProcessorException{
		if(tpp == null){
			throw new TaskProcessorException(event);
		}
		tpp.setStatus(TppModel.STATUS_FAIL);
		String loggerPrefix = getLoggerPrefix(tppTradeLog.getTradeType());
		tpp.setRespDesc(loggerPrefix + "处理失败");
		tppService.update(tpp);
	}
	
}
